Skip to content

gh-78327: Use PyObject_HashNotImplemented for ctypes data types - #159736

Merged
ZeroIntensity merged 3 commits into
python:mainfrom
ZeroIntensity:ctypes/hash-not-implemented
Oct 19, 2026
Merged

ZeroIntensity merged 3 commits into
python:mainfrom
ZeroIntensity:ctypes/hash-not-implemented

Conversation

@ZeroIntensity

@ZeroIntensity ZeroIntensity commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

This is a minor breaking change (isinstance(obj, Hashable) now correctly returns False instead of True), so I'm opting not to backport this.

@ZeroIntensity
ZeroIntensity merged commit 3f09229 into python:main Oct 19, 2026
56 checks passed
@ZeroIntensity
ZeroIntensity deleted the ctypes/hash-not-implemented branch October 19, 2026 22:12
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 19, 2026
@vstinner

Copy link
Copy Markdown
Member

test_ctypes started to fail on AMD64 Windows Server 2025 Clang 3.x: https://buildbot.python.org/#/builders/2261/builds/512

Example:

FAIL: test_unhashable (test.test_ctypes.test_simplesubclasses.Test.test_unhashable) (cls=<class 'ctypes.c_long'>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "B:\uildarea\3.x.ware-ws2025\build\Lib\test\test_ctypes\test_simplesubclasses.py", line 37, in test_unhashable
    self.assertIsNone(cls.__hash__)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
AssertionError: <slot wrapper '__hash__' of '_ctypes._CData' objects> is not None

I suspect that it's related to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants